package com.share.exception;

import lombok.Getter;

/**
 * author:caifan
 * date:2020/1/2
 */
@Getter
public class SysException extends RuntimeException {
    private String code;
    private String message;
    private Object[] args;//国际化参数可以使用

    public SysException(String message) {
        this.message = message;
        this.code = "-1";
        this.args = null;
    }

    public SysException(String code, String message) {
        this.message = message;
        this.code = code;
        this.args = null;
    }

    public SysException(String message, Object... args) {
        this.message = message;
        this.code = "-1";
        this.args = args;
    }

    public SysException(ExceptionEnum exceptionEnum, Object... args) {
        this.code = exceptionEnum.getCode();
        this.message = exceptionEnum.getMessage();
        this.args = args;
    }

}
